package com.zyh.number;

import java.math.BigInteger;

public class NumberDemo5 {
    public static void main(String[] args) {
        String num="100000000000000000000000000000000000000000000000000000000";
        BigInteger big1 = new BigInteger(num);
        System.out.println("big1 = " + big1);
        BigInteger big2 = new BigInteger("2");
        System.out.println("big2 = " + big2);
        //加法
        BigInteger add = big1.add(big2);
        System.out.println("add = " + add);
        //减法
        BigInteger subtract = big1.subtract(big2);
        System.out.println("subtract = " + subtract);
        //乘法
        BigInteger multiply = big1.multiply(big2);
        System.out.println("multiply = " + multiply);
        //除法
        BigInteger divide = big1.divide(big2);
        System.out.println("divide = " + divide);
        //取余
        BigInteger remainder = big1.remainder(big2);
        System.out.println("remainder = " + remainder);
        //除法和取余
        BigInteger[] bigIntegers = big1.divideAndRemainder(big2);
        System.out.println(bigIntegers[0]);
        System.out.println(bigIntegers[1]);
        System.out.println(bigIntegers.length);
    }
}
